home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / umich / falcon / programm.ing / nt_dsp1.lzh / NT_DSP1.MSA / FLOAT / FPABS.ASM < prev    next >
Assembly Source File  |  1989-01-24  |  2KB  |  68 lines

  1. ;
  2. ; This program originally available on the Motorola DSP bulletin board.
  3. ; It is provided under a DISCLAIMER OF WARRANTY available from
  4. ; Motorola DSP Operation, 6501 Wm. Cannon Drive W., Austin, Tx., 78735.
  5. ; Last Update 5 Oct 87   Version 2.0
  6. ;
  7. ; Entry points: fabs_a  R = absolute value(A)
  8. ;               fabs_x  R = absolute value(X)
  9. ;
  10. ;       m = 24 bit mantissa (two's complement, normalized fraction)
  11. ;
  12. ;       e = 14 bit exponent (unsigned integer, biased by +8191)
  13. ;
  14. ; Input variables:
  15. ;
  16. ;   X   x1 = mx  (normalized)
  17. ;       x0 = ex
  18. ;
  19. ;   A   a2 = sign extension of ma
  20. ;       a1 = ma  (normalized)
  21. ;       a0 = zero
  22. ;
  23. ;       b2 = sign extension of ea (always zero)
  24. ;       b1 = ea
  25. ;       b0 = zero
  26. ;
  27. ; Output variables:
  28. ;
  29. ;   R   a2 = sign extension of mr
  30. ;       a1 = mr  (normalized)
  31. ;       a0 = zero
  32. ;
  33. ;       b2 = sign extension of er (always zero)
  34. ;       b1 = er
  35. ;       b0 = zero
  36. ;
  37. ; Error conditions:     Set CCR L=1 if floating point overflow.  Result
  38. ;                       is set to the maximum floating point value of the
  39. ;                       correct sign.  The CCR L bit remains set until
  40. ;                       cleared by the user.
  41. ;
  42. ;                       Set CCR L=1 if floating point underflow.  Result
  43. ;                       is set to floating point zero.  The CCR L bit
  44. ;                       remains set until cleared by the user.
  45. ;
  46. ; Assumes n0, m0, shift constant table and scaling modes
  47. ; initialized by previous call to the subroutine "fpinit".
  48. ;
  49. ; Alters Data ALU Registers
  50. ;       a2      a1      a0      a
  51. ;       b2      b1      b0      b
  52. ;       x1      x0      y1      y0
  53. ;
  54. ; Alters Address Registers
  55. ;       r0
  56. ;
  57. ; Alters Program Control Registers
  58. ;       pc      sr
  59. ;
  60. ; Uses 0 locations on System Stack
  61. ;
  62. ;
  63. fabs_x  tfr     x0,b    x1,a            ;get ex, mx
  64. fabs_a  tst     a                       ;check for negative ma
  65.         jmi     fneg_a                  ;negate if negative
  66.         rts
  67.